
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>4.4 上传头像 · Laravel学习-从零开发论坛系统</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="kaleozhou">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../chapter5/readme.html" />
    
    
    <link rel="prev" href="3.html" />
    

    
        <link rel="shortcut icon" href='../book.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../book.ico' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../book.ico'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../book.ico">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../book.ico">
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.kaleozhou.top" target="_blank" class="custom-link">我的博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    序言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1/1.html">
            
                <a href="../chapter1/1.html">
            
                    
                    第一章 开发环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../chapter2/readme.html">
            
                <a href="../chapter2/readme.html">
            
                    
                    第二章 创建应用及布局
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../chapter2/1.html">
            
                <a href="../chapter2/1.html">
            
                    
                    2.1 创建应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../chapter2/2.html">
            
                <a href="../chapter2/2.html">
            
                    
                    2.2 创建布局文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../chapter2/3.html">
            
                <a href="../chapter2/3.html">
            
                    
                    2.3 创建首页展示
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../chapter2/4.html">
            
                <a href="../chapter2/4.html">
            
                    
                    2.4 调整样式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../chapter3/readme.html">
            
                <a href="../chapter3/readme.html">
            
                    
                    第三章 laravel组件的使用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter3/1.html">
            
                <a href="../chapter3/1.html">
            
                    
                    3.1 用户脚手架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter3/2.html">
            
                <a href="../chapter3/2.html">
            
                    
                    3.2 注册验证码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../chapter3/3.html">
            
                <a href="../chapter3/3.html">
            
                    
                    3.3 邮箱验证
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../chapter3/4.html">
            
                <a href="../chapter3/4.html">
            
                    
                    3.4 密码重置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="readme.html">
            
                <a href="readme.html">
            
                    
                    第四章 基础功能开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="1.html">
            
                <a href="1.html">
            
                    
                    4.1 个人页面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="2.html">
            
                <a href="2.html">
            
                    
                    4.2 编辑个人资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="3.html">
            
                <a href="3.html">
            
                    
                    4.3 显示个人资料
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.4" data-path="4.html">
            
                <a href="4.html">
            
                    
                    4.4 上传头像
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../chapter5/readme.html">
            
                <a href="../chapter5/readme.html">
            
                    
                    第五章 帖子功能开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../chapter5/1.html">
            
                <a href="../chapter5/1.html">
            
                    
                    5.1 帖子分类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../chapter5/2.html">
            
                <a href="../chapter5/2.html">
            
                    
                    5.2 代码生成器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../chapter5/3.html">
            
                <a href="../chapter5/3.html">
            
                    
                    5.3 生成话题骨架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../chapter5/4.html">
            
                <a href="../chapter5/4.html">
            
                    
                    5.4 假数据填充
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../chapter5/5.html">
            
                <a href="../chapter5/5.html">
            
                    
                    5.5 话题列表页面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../chapter5/6.html">
            
                <a href="../chapter5/6.html">
            
                    
                    5.6 性能优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../chapter5/7.html">
            
                <a href="../chapter5/7.html">
            
                    
                    5.7 分类下的话题列表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../chapter5/8.html">
            
                <a href="../chapter5/8.html">
            
                    
                    5.8 话题排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../chapter5/9.html">
            
                <a href="../chapter5/9.html">
            
                    
                    5.9 用户发布的话题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../chapter6/readme.html">
            
                <a href="../chapter6/readme.html">
            
                    
                    第六章 话题开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../chapter6/1.html">
            
                <a href="../chapter6/1.html">
            
                    
                    6.1 新建话题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../chapter6/2.html">
            
                <a href="../chapter6/2.html">
            
                    
                    6.2 编辑器优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../chapter6/3.html">
            
                <a href="../chapter6/3.html">
            
                    
                    6.3 上传图片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../chapter6/4.html">
            
                <a href="../chapter6/4.html">
            
                    
                    6.4 显示帖子
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../chapter6/5.html">
            
                <a href="../chapter6/5.html">
            
                    
                    6.5 XSS安全漏洞
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../chapter6/6.html">
            
                <a href="../chapter6/6.html">
            
                    
                    6.6 编辑帖子
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >4.4 上传头像</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#44-&#x4E0A;&#x4F20;&#x5934;&#x50CF;"><b></b>4.4 &#x4E0A;&#x4F20;&#x5934;&#x50CF;</a></li><ul><li><span class="title-icon "></span><a href="#&#x6A21;&#x578B;&#x6587;&#x4EF6;&#x4FEE;&#x6539;"><b></b>&#x6A21;&#x578B;&#x6587;&#x4EF6;&#x4FEE;&#x6539;</a></li><li><span class="title-icon "></span><a href="#&#x7F16;&#x8F91;&#x9875;&#x9762;"><b></b>&#x7F16;&#x8F91;&#x9875;&#x9762;</a></li><li><span class="title-icon "></span><a href="#&#x5B58;&#x50A8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;"><b></b>&#x5B58;&#x50A8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;</a></li><li><span class="title-icon "></span><a href="#&#x663E;&#x793A;&#x5934;&#x50CF;"><b></b>&#x663E;&#x793A;&#x5934;&#x50CF;</a></li><li><span class="title-icon "></span><a href="#&#x56FE;&#x7247;&#x9A8C;&#x8BC1;"><b></b>&#x56FE;&#x7247;&#x9A8C;&#x8BC1;</a></li><li><span class="title-icon "></span><a href="#&#x88C1;&#x526A;&#x5934;&#x50CF;"><b></b>&#x88C1;&#x526A;&#x5934;&#x50CF;</a></li><li><span class="title-icon "></span><a href="#&#x6D4B;&#x8BD5;"><b></b>&#x6D4B;&#x8BD5;</a></li><li><span class="title-icon "></span><a href="#&#x6388;&#x6743;&#x8BBF;&#x95EE;"><b></b>&#x6388;&#x6743;&#x8BBF;&#x95EE;</a></li><li><span class="title-icon "></span><a href="#&#x9650;&#x5236;&#x6E38;&#x5BA2;&#x8BBF;&#x95EE;"><b></b>&#x9650;&#x5236;&#x6E38;&#x5BA2;&#x8BBF;&#x95EE;</a></li><li><span class="title-icon "></span><a href="#&#x767B;&#x5F55;&#x7528;&#x6237;&#x53EA;&#x80FD;&#x53C8;&#x8BE5;&#x81EA;&#x5DF1;&#x7684;&#x8D44;&#x6599;"><b></b>&#x767B;&#x5F55;&#x7528;&#x6237;&#x53EA;&#x80FD;&#x53C8;&#x8BE5;&#x81EA;&#x5DF1;&#x7684;&#x8D44;&#x6599;</a></li><li><span class="title-icon "></span><a href="#&#x6388;&#x6743;&#x6D4B;&#x8BD5;"><b></b>&#x6388;&#x6743;&#x6D4B;&#x8BD5;</a></li></ul></ul></div><a href="#44-&#x4E0A;&#x4F20;&#x5934;&#x50CF;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="44-&#x4E0A;&#x4F20;&#x5934;&#x50CF;"><a name="44-&#x4E0A;&#x4F20;&#x5934;&#x50CF;" class="anchor-navigation-ex-anchor" href="#44-&#x4E0A;&#x4F20;&#x5934;&#x50CF;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="44-&#x4E0A;&#x4F20;&#x5934;&#x50CF;" class="plugin-anchor" href="#44-&#x4E0A;&#x4F20;&#x5934;&#x50CF;"><i class="fa fa-link" aria-hidden="true"></i></a>4.4 &#x4E0A;&#x4F20;&#x5934;&#x50CF;</h1>
<h2 id="&#x6A21;&#x578B;&#x6587;&#x4EF6;&#x4FEE;&#x6539;"><a name="&#x6A21;&#x578B;&#x6587;&#x4EF6;&#x4FEE;&#x6539;" class="anchor-navigation-ex-anchor" href="#&#x6A21;&#x578B;&#x6587;&#x4EF6;&#x4FEE;&#x6539;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x6A21;&#x578B;&#x6587;&#x4EF6;&#x4FEE;&#x6539;" class="plugin-anchor" href="#&#x6A21;&#x578B;&#x6587;&#x4EF6;&#x4FEE;&#x6539;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6A21;&#x578B;&#x6587;&#x4EF6;&#x4FEE;&#x6539;</h2>
<p>&#x9996;&#x5148;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728;User&#x6A21;&#x578B;&#x91CC;&#x9762;&#x5C06;avtar&#x5B57;&#x6BB5;&#x52A0;&#x5165;&#x5230;&#x5141;&#x8BB8;&#x4FEE;&#x6539;&#x7684;&#x767D;&#x540D;&#x5355;$fillable&#x4E2D;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim resources/views/users/edit.blade.php
</code></pre><p>&#x5185;&#x5BB9;&#x5982;&#x4E0B;</p>
<pre><code>&lt;?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\MustVerifyEmail as MustVerifyEmailTrait;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail as MustVerifyEmailContract;

class User extends Authenticatable implements MustVerifyEmailContract
{
    use Notifiable, MustVerifyEmailTrait;

    protected $fillable = [
        &apos;name&apos;, &apos;email&apos;, &apos;password&apos;,&apos;avatar&apos;,
    ];

    protected $hidden = [
        &apos;password&apos;, &apos;remember_token&apos;,
    ];
}
</code></pre><h2 id="&#x7F16;&#x8F91;&#x9875;&#x9762;"><a name="&#x7F16;&#x8F91;&#x9875;&#x9762;" class="anchor-navigation-ex-anchor" href="#&#x7F16;&#x8F91;&#x9875;&#x9762;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x7F16;&#x8F91;&#x9875;&#x9762;" class="plugin-anchor" href="#&#x7F16;&#x8F91;&#x9875;&#x9762;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7F16;&#x8F91;&#x9875;&#x9762;</h2>
<p>&#x6211;&#x4EEC;&#x5728;&#x8D44;&#x6599;&#x7F16;&#x8F91;&#x9875;&#x9762;&#x7684;[&#x4E2A;&#x4EBA;&#x7B80;&#x4ECB;]&#x7F16;&#x8F91;&#x6846;&#x4E0B;&#x9762;&#xFF0C;&#x589E;&#x52A0;&#x5934;&#x50CF;&#x4E0A;&#x4F20;&#x7684;&#x9009;&#x9879;</p>
<pre><code>.
.
.
          &lt;div class=&quot;form-group&quot;&gt;
            &lt;label for=&quot;introduction-field&quot;&gt;&#x4E2A;&#x4EBA;&#x7B80;&#x4ECB;&lt;/label&gt;
            &lt;textarea name=&quot;introduction&quot; id=&quot;introduction-field&quot; class=&quot;form-control&quot; rows=&quot;3&quot;&gt;{{ old(&apos;introduction&apos;, $user-&gt;introduction) }}&lt;/textarea&gt;
          &lt;/div&gt;
          &lt;div class=&quot;form-group mb-4&quot;&gt;
            &lt;label for=&quot;&quot; class=&quot;avatar-label&quot;&gt;&#x7528;&#x6237;&#x5934;&#x50CF;&lt;/label&gt;
            &lt;input type=&quot;file&quot; name=&quot;avatar&quot; class=&quot;form-control-file&quot;&gt;

            @if($user-&gt;avatar)
              &lt;br&gt;
              &lt;img class=&quot;thumbnail img-responsive&quot; src=&quot;{{ $user-&gt;avatar }}&quot; width=&quot;200&quot; /&gt;
            @endif
          &lt;/div&gt;
.
.
.
</code></pre><p>&#x6548;&#x679C;&#x5982;&#x4E0B;
<img src="http://images.kaleozhou.top/4.4-01.png" alt="4.4-01.png">
&#x5728;Laravel&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x76F4;&#x63A5;&#x901A;&#x8FC7;Request&#x6765;&#x83B7;&#x53D6;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x4EE5;&#x4E0B;&#x4E24;&#x79CD;&#x529E;&#x6CD5;</p>
<pre><code>// &#x7B2C;&#x4E00;&#x79CD;&#x65B9;&#x6CD5;
$file = $request-&gt;file(&apos;avatar&apos;);

// &#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x6CD5;&#xFF0C;&#x53EF;&#x8BFB;&#x6027;&#x66F4;&#x9AD8;
$file = $request-&gt;avatar;
</code></pre><p>&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x5728;&#x63A7;&#x5236;&#x5668;update()&#x65B9;&#x6CD5;&#x4E2D;&#x5229;&#x7528;laravel&#x7684;dd()&#x8C03;&#x8BD5;&#x65B9;&#x6CD5;&#xFF0C;&#x6765;&#x67E5;&#x770B;&#x6587;&#x4EF6;&#x4E0A;&#x4F20;&#x7684;&#x60C5;&#x51B5;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim app/Http/Controllers/UsersController.php
</code></pre><p>&#x5185;&#x5BB9;&#x5982;&#x4E0B;</p>
<pre><code>.
.
.
    public function update(UserRequest $request,User $user)
    {
        dd($request-&gt;avatar);

        $user-&gt;update($request-&gt;all());
        return redirect()-&gt;route(&apos;users.show&apos;,$user-&gt;id)-&gt;with(&apos;success&apos;,&apos;&#x4E2A;&#x4EBA;&#x8D44;&#x6599;&#x66F4;&#x65B0;&#x6210;&#x529F;!&apos;);
    }
.
.
.
</code></pre><p>&#x6548;&#x679C;
<img src="http://images.kaleozhou.top/4.4-02.png" alt="4.4-02.png">
&#x5E94;&#x8BE5;&#x663E;&#x793A;&#x56FE;&#x7247;&#x5BF9;&#x8C61;&#xFF0C;&#x8FD9;&#x91CC;&#x663E;&#x793A;&#x7684;&#x662F;&#x5B57;&#x7B26;&#x4E32;
&#x5728;&#x4FEE;&#x6539;&#x7F16;&#x8F91;&#x9875;&#x9762;&#xFF0C;&#x7ED9;&#x8868;&#x5355;&#x6DFB;&#x52A0; </p>
<pre><code>.
.
.
        &lt;form action=&quot;{{ route(&apos;users.update&apos;, $user-&gt;id) }}&quot; method=&quot;POST&quot; accept-charset=&quot;UTF-8&quot; enctype=&apos;multipart/form-data&apos;&gt;

.
.
.
</code></pre><p>&#x518D;&#x6B21;&#x4E0A;&#x4F20;&#x6D4B;&#x8BD5;
<img src="http://images.kaleozhou.top/4.4-03.png" alt="4.4-03.png">
&#x8FD9;&#x6B21;&#x5BF9;&#x4E86;&#x53EF;&#x4EE5;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x6253;&#x5370;&#x51FA;&#x6765;&#x4E86;&#x3002;Laravel&#x7684;[&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x6587;&#x4EF6;&#x5BF9;&#x8C61;]&#x5E95;&#x5C42;&#x4F7F;&#x7528;&#x4E86;symfony&#x6846;&#x67B6;&#x7684;UploaderFile&#x5BF9;&#x8C61;&#x8FDB;&#x884C;&#x6E32;&#x67D3;&#xFF0C;&#x4E3A;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x4FBF;&#x6377;&#x7684;&#x6587;&#x4EF6;&#x8BFB;&#x53D6;&#x548C;&#x7BA1;&#x7406;&#x63A5;&#x53E3;&#xFF0C;&#x6211;&#x4EEC;&#x5C06;&#x5728;&#x540E;&#x9762;&#x4F7F;&#x7528;&#x8FD9;&#x4E9B;&#x65B9;&#x6CD5;&#xFF0C;
&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x80FD;&#x5F97;&#x5230;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x7684;&#x56FE;&#x7247;&#x6570;&#x636E;&#x4E86;&#xFF0C;&#x63A5;&#x4E0B;&#x662F;&#x5BF9;&#x56FE;&#x7247;&#x8FDB;&#x884C;&#x5B58;&#x50A8;&#x3002;</p>
<h2 id="&#x5B58;&#x50A8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;"><a name="&#x5B58;&#x50A8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;" class="anchor-navigation-ex-anchor" href="#&#x5B58;&#x50A8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x5B58;&#x50A8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;" class="plugin-anchor" href="#&#x5B58;&#x50A8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5B58;&#x50A8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;</h2>
<p>&#x672C;&#x9879;&#x76EE;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x4E0D;&#x6B62;&#x4E0A;&#x4F20;&#x5934;&#x50CF;&#x9700;&#x8981;&#x7528;&#x5230;[&#x56FE;&#x7247;&#x4E0A;&#x4F20;&#x529F;&#x80FD;]&#xFF0C;&#x5728;&#x540E;&#x9762;&#x7684;&#x53D1;&#x5E03;&#x5E16;&#x5B50;&#x529F;&#x80FD;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x4F1A;&#x5141;&#x8BB8;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x56FE;&#x7247;&#xFF0C;&#x6240;&#x4EE5;&#x6B64;&#x5904;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x9884;&#x5148;&#x8BBE;&#x8BA1;&#x4E00;&#x4E0B;&#x56FE;&#x7247;&#x4E0A;&#x4F20;&#x7684;&#x76F8;&#x5173;&#x903B;&#x8F91;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5C06;[&#x56FE;&#x7247;&#x4E0A;&#x4F20;]&#x6838;&#x5FC3;&#x64CD;&#x4F5C;&#x505A;&#x6210;&#x4E00;&#x4E2A;&#x5DE5;&#x5177;&#x7C7B;
app/Headlers/ImageUploadHandler.php</p>
<pre><code>&lt;?php

namespace App\Handlers;

class ImageUploadHandler
{
    // &#x53EA;&#x5141;&#x8BB8;&#x4EE5;&#x4E0B;&#x540E;&#x7F00;&#x540D;&#x7684;&#x56FE;&#x7247;&#x6587;&#x4EF6;&#x4E0A;&#x4F20;
    protected $allowed_ext = [&quot;png&quot;, &quot;jpg&quot;, &quot;gif&quot;, &apos;jpeg&apos;];

    public function save($file, $folder, $file_prefix)
    {
        // &#x6784;&#x5EFA;&#x5B58;&#x50A8;&#x7684;&#x6587;&#x4EF6;&#x5939;&#x89C4;&#x5219;&#xFF0C;&#x503C;&#x5982;&#xFF1A;uploads/images/avatars/201709/21/
        // &#x6587;&#x4EF6;&#x5939;&#x5207;&#x5272;&#x80FD;&#x8BA9;&#x67E5;&#x627E;&#x6548;&#x7387;&#x66F4;&#x9AD8;&#x3002;
        $folder_name = &quot;uploads/images/$folder/&quot; . date(&quot;Ym/d&quot;, time());

        // &#x6587;&#x4EF6;&#x5177;&#x4F53;&#x5B58;&#x50A8;&#x7684;&#x7269;&#x7406;&#x8DEF;&#x5F84;&#xFF0C;`public_path()` &#x83B7;&#x53D6;&#x7684;&#x662F; `public` &#x6587;&#x4EF6;&#x5939;&#x7684;&#x7269;&#x7406;&#x8DEF;&#x5F84;&#x3002;
        // &#x503C;&#x5982;&#xFF1A;/home/vagrant/Code/larabbs/public/uploads/images/avatars/201709/21/
        $upload_path = public_path() . &apos;/&apos; . $folder_name;

        // &#x83B7;&#x53D6;&#x6587;&#x4EF6;&#x7684;&#x540E;&#x7F00;&#x540D;&#xFF0C;&#x56E0;&#x56FE;&#x7247;&#x4ECE;&#x526A;&#x8D34;&#x677F;&#x91CC;&#x9ECF;&#x8D34;&#x65F6;&#x540E;&#x7F00;&#x540D;&#x4E3A;&#x7A7A;&#xFF0C;&#x6240;&#x4EE5;&#x6B64;&#x5904;&#x786E;&#x4FDD;&#x540E;&#x7F00;&#x4E00;&#x76F4;&#x5B58;&#x5728;
        $extension = strtolower($file-&gt;getClientOriginalExtension()) ?: &apos;png&apos;;

        // &#x62FC;&#x63A5;&#x6587;&#x4EF6;&#x540D;&#xFF0C;&#x52A0;&#x524D;&#x7F00;&#x662F;&#x4E3A;&#x4E86;&#x589E;&#x52A0;&#x8FA8;&#x6790;&#x5EA6;&#xFF0C;&#x524D;&#x7F00;&#x53EF;&#x4EE5;&#x662F;&#x76F8;&#x5173;&#x6570;&#x636E;&#x6A21;&#x578B;&#x7684; ID
        // &#x503C;&#x5982;&#xFF1A;1_1493521050_7BVc9v9ujP.png
        $filename = $file_prefix . &apos;_&apos; . time() . &apos;_&apos; . str_random(10) . &apos;.&apos; . $extension;

        // &#x5982;&#x679C;&#x4E0A;&#x4F20;&#x7684;&#x4E0D;&#x662F;&#x56FE;&#x7247;&#x5C06;&#x7EC8;&#x6B62;&#x64CD;&#x4F5C;
        if ( ! in_array($extension, $this-&gt;allowed_ext)) {
            return false;
        }

        // &#x5C06;&#x56FE;&#x7247;&#x79FB;&#x52A8;&#x5230;&#x6211;&#x4EEC;&#x7684;&#x76EE;&#x6807;&#x5B58;&#x50A8;&#x8DEF;&#x5F84;&#x4E2D;
        $file-&gt;move($upload_path, $filename);

        return [
            &apos;path&apos; =&gt; config(&apos;app.url&apos;) . &quot;/$folder_name/$filename&quot;
        ];
    }
}
</code></pre><p>&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728;UsersController&#x91CC;&#x8C03;&#x7528;(&#x6CE8;&#x610F;&#x9876;&#x90E8;use&#x5F15;&#x5165;),&#x5E76;&#x4FEE;&#x6539;&#x4FE1;&#x606F;&#x5982;&#x4E0B;
app/Http/Controller/UsersController.php</p>
<pre><code>&lt;?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\User;
use App\Http\Requests\UserRequest;
use App\Handlers\ImageUploadHandler;

class UsersController extends Controller
{
    //&#x4E2A;&#x4EBA;&#x9875;&#x9762;&#x5C55;&#x793A;
    public function show(User $user)
    {
        return view(&apos;users.show&apos;,compact(&apos;user&apos;));
    }
    //&#x8D44;&#x6599;&#x7F16;&#x8F91;
    public function edit(User $user)
    {
        return view(&apos;users.edit&apos;,compact(&apos;user&apos;));
    }
    //&#x66F4;&#x65B0;&#x7528;&#x6237;&#x4FE1;&#x606F;
    public function update(UserRequest $request,ImageUploadHandler $uploader,User $user)
    {
        dd($request-&gt;avatar);
        $data=$request-&gt;all();
        if($request-&gt;avatar){
            $result=$uploader-&gt;save($request-&gt;avatar,&apos;avatars&apos;,$user-&gt;id);
            if($result)
            {
                $data[&apos;avatar&apos;]=$result[&apos;path&apos;];
            }
        }

        $user-&gt;update($data);
        return redirect()-&gt;route(&apos;users.show&apos;,$user-&gt;id)-&gt;with(&apos;success&apos;,&apos;&#x4E2A;&#x4EBA;&#x8D44;&#x6599;&#x66F4;&#x65B0;&#x6210;&#x529F;!&apos;);
    }
}
</code></pre><p>&#x4E0A;&#x4F20;&#x6548;&#x679C;
<img src="http://images.kaleozhou.top/4.4-04.png" alt="4.4-04.png">
&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x5C06;&#x5934;&#x50CF;&#x663E;&#x793A;&#x51FA;&#x6765;
&#x521A;&#x624D;&#x6211;&#x4EEC;&#x4E0A;&#x4F20;&#x4E86;&#x5934;&#x50CF;&#xFF0C;&#x4E0D;&#x60F3;&#x52A0;&#x5165;&#x5230;&#x7248;&#x672C;&#x63A7;&#x5236;&#x4E2D;
&#x521B;&#x5EFA;&#x5982;&#x4E0B;&#x6587;&#x4EF6;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim public/uploads/images/avatars/.gitignore
</code></pre><p>&#x5185;&#x5BB9;&#x5982;&#x4E0B;</p>
<pre><code>*
!.gitignore
</code></pre><h2 id="&#x663E;&#x793A;&#x5934;&#x50CF;"><a name="&#x663E;&#x793A;&#x5934;&#x50CF;" class="anchor-navigation-ex-anchor" href="#&#x663E;&#x793A;&#x5934;&#x50CF;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x663E;&#x793A;&#x5934;&#x50CF;" class="plugin-anchor" href="#&#x663E;&#x793A;&#x5934;&#x50CF;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x663E;&#x793A;&#x5934;&#x50CF;</h2>
<p>&#x76EE;&#x524D;&#x6211;&#x4EEC;&#x6709;&#x4E24;&#x4E2A;&#x5730;&#x65B9;&#x7528;&#x5230;&#x7528;&#x6237;&#x5934;&#x50CF;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x662F;&#x4E2A;&#x4EBA;&#x7A7A;&#x95F4;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x662F;&#x9876;&#x90E8;&#x5BFC;&#x822A;&#x680F;
&#x4FEE;&#x6539;&#x4E2A;&#x4EBA;&#x7A7A;&#x95F4;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim resources/views/users/show.blade.php
</code></pre><p>&#x5185;&#x5BB9;</p>
<pre><code>.
.
.
        &lt;img class=&quot;card-img-top&quot; src=&apos;{{$user-&gt;avatar}}&apos; alt=&quot;{{ $user-&gt;name }}&quot;&gt;
.
.
.
</code></pre><p>&#x6548;&#x679C;&#x5982;&#x4E0B;
<img src="http://images.kaleozhou.top/4.4-05.png" alt="4.4-05.png">
&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x4FEE;&#x6539;&#x9876;&#x90E8;&#x5BFC;&#x822A;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim resources/views/layouts/_header.blade.php
</code></pre><p>&#x5185;&#x5BB9;&#x5982;&#x4E0B;</p>
<pre><code>.
.
.
 &lt;img src=&quot;{{Auth::user()-&gt;avatar}}&quot; class=&quot;img-responsive img-circle&quot; width=&quot;30px&quot; height=&quot;30px&quot;&gt;
.
.
.
</code></pre><p>&#x67E5;&#x770B;&#x6548;&#x679C;
<img src="http://images.kaleozhou.top/4.4-06.png" alt="4.4-06.png"></p>
<h2 id="&#x56FE;&#x7247;&#x9A8C;&#x8BC1;"><a name="&#x56FE;&#x7247;&#x9A8C;&#x8BC1;" class="anchor-navigation-ex-anchor" href="#&#x56FE;&#x7247;&#x9A8C;&#x8BC1;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x56FE;&#x7247;&#x9A8C;&#x8BC1;" class="plugin-anchor" href="#&#x56FE;&#x7247;&#x9A8C;&#x8BC1;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x56FE;&#x7247;&#x9A8C;&#x8BC1;</h2>
<p>&#x5F53;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x5206;&#x8FA8;&#x7387;&#x592A;&#x5C0F;&#x7684;&#x56FE;&#x7247;&#x65F6;&#xFF0C;&#x4F1A;&#x5F71;&#x54CD;&#x7F51;&#x7AD9;&#x7684;&#x7F8E;&#x89C2;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5BF9;&#x56FE;&#x7247;&#x7684;&#x5206;&#x8FA8;&#x7387;&#x5927;&#x5C0F;&#x52A0;&#x4EE5;&#x9650;&#x5236;&#x3002;&#x5F97;&#x76CA;&#x4E8E;Laravel&#x5F3A;&#x5927;&#x7684;&#x8868;&#x5355;&#x9A8C;&#x8BC1;&#x529F;&#x80FD;
&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x8981;&#x5728;UserRequest&#x4E2D;&#x589E;&#x52A0;&#x56FE;&#x7247;&#x7684;&#x9A8C;&#x8BC1;&#x89C4;&#x5219;&#x5373;&#x53EF;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) vim app/Http/Requests/UserRequest.php
</code></pre><p>&#x5185;&#x5BB9;&#x5982;&#x4E0B;</p>
<pre><code>&lt;?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Auth;

class UserRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            &apos;name&apos;=&gt;&apos;required|between:3,25|regex:/^[A-Za-z0-9\-\_]+$/|unique:users,name,&apos;.Auth::id(),
            &apos;email&apos;=&gt;&apos;required|email&apos;,
            &apos;introduction&apos;=&gt;&apos;max:80&apos;,
            &apos;avatar&apos;=&gt;&apos;mimes;jpeg,bmp,png,gif|dimensions:min_width=208,min_height=208&apos;,
        ];
    }
    public function messages()
    {
        return [
            &apos;avatar.mimes&apos;=&gt;&apos;&#x5934;&#x50CF;&#x5FC5;&#x987B;&#x662F;jpeg,bmp,png,gif&#x683C;&#x5F0F;&#x7684;&#x56FE;&#x7247;&apos;,
            &apos;avatar.dimensions&apos;=&gt;&apos;&#x56FE;&#x7247;&#x7684;&#x6E05;&#x6670;&#x5EA6;&#x4E0D;&#x591F;&#xFF0C;&#x5BBD;&#x548C;&#x9AD8;&#x9700;&#x8981;208px&#x4EE5;&#x4E0A;&apos;,
            &apos;name.unique&apos; =&gt; &apos;&#x7528;&#x6237;&#x540D;&#x5DF2;&#x88AB;&#x5360;&#x7528;&#xFF0C;&#x8BF7;&#x91CD;&#x65B0;&#x586B;&#x5199;&apos;,
            &apos;name.regex&apos; =&gt; &apos;&#x7528;&#x6237;&#x540D;&#x53EA;&#x652F;&#x6301;&#x82F1;&#x6587;&#x3001;&#x6570;&#x5B57;&#x3001;&#x6A2A;&#x6760;&#x548C;&#x4E0B;&#x5212;&#x7EBF;&#x3002;&apos;,
            &apos;name.between&apos; =&gt; &apos;&#x7528;&#x6237;&#x540D;&#x5FC5;&#x987B;&#x4ECB;&#x4E8E; 3 - 25 &#x4E2A;&#x5B57;&#x7B26;&#x4E4B;&#x95F4;&#x3002;&apos;,
            &apos;name.required&apos; =&gt; &apos;&#x7528;&#x6237;&#x540D;&#x4E0D;&#x80FD;&#x4E3A;&#x7A7A;&#x3002;&apos;,
        ];
    }
}
</code></pre><h2 id="&#x88C1;&#x526A;&#x5934;&#x50CF;"><a name="&#x88C1;&#x526A;&#x5934;&#x50CF;" class="anchor-navigation-ex-anchor" href="#&#x88C1;&#x526A;&#x5934;&#x50CF;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x88C1;&#x526A;&#x5934;&#x50CF;" class="plugin-anchor" href="#&#x88C1;&#x526A;&#x5934;&#x50CF;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x88C1;&#x526A;&#x5934;&#x50CF;</h2>
<p>&#x6709;&#x65F6;&#x5019;&#x7528;&#x6237;&#x4E0A;&#x4F20;&#x4E86;&#x5206;&#x8FA8;&#x7387;&#x8F83;&#x5927;&#x7684;&#x56FE;&#x7247;,&#x6211;&#x4EEC;&#x5C31;&#x9700;&#x8981;&#x5BF9;&#x56FE;&#x7247;&#x505A;&#x4E00;&#x4E9B;&#x5904;&#x7406;&#xFF0C;&#x6211;&#x4EEC;&#x7528;Intervention/image&#x6269;&#x5C55;&#x5305;&#x6765;&#x5904;&#x7406;&#x56FE;&#x7247;&#x88C1;&#x526A;&#x903B;&#x8F91;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5148;&#x5B89;&#x88C5;&#x6269;&#x5C55;&#x5305;:</p>
<pre><code>vagrant@homestead:~/Code/kaleobbs$ composer require intervention/image
Using version ^2.4 for intervention/image
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating optimized autoload files
&gt; Illuminate\Foundation\ComposerScripts::postAutoloadDump
&gt; @php artisan package:discover --ansi
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: fideloper/proxy
Discovered Package: intervention/image
Discovered Package: laravel/nexmo-notification-channel
Discovered Package: laravel/slack-notification-channel
Discovered Package: laravel/tinker
Discovered Package: mews/captcha
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
</code></pre><p>&#x63A5;&#x4E0B;&#x6765;&#x6267;&#x884C;&#x547D;&#x4EE4;&#x83B7;&#x53D6;&#x914D;&#x7F6E;&#x4FE1;&#x606F;</p>
<pre><code>vagrant@homestead:~/Code/kaleobbs$ php artisan vendor:publish --provider=&quot;Intervention\Image\ImageServiceProviderLaravel5&quot;
Copied File [/vendor/intervention/image/src/config/config.php] To [/config/image.php]
Publishing complete.
</code></pre><p>&#x6253;&#x5F00;config/image.php&#x6587;&#x4EF6;&#xFF0C;&#x9ED8;&#x8BA4;&#x652F;&#x6301;gd&#x9A71;&#x52A8;&#x5668;
&#x6211;&#x4EEC;&#x5F00;&#x59CB;&#x5199;&#x88C1;&#x526A;&#x903B;&#x8F91;:</p>
<pre><code>&lt;?php
/** =============================================================================
 * @name ImageUploadHandler.php
 * @date date 2019&#x5E74;04&#x6708;12&#x65E5; &#x661F;&#x671F;&#x4E94; 10&#x65F6;40&#x5206;44&#x79D2;
 * @author kaleo &lt;kaleo1990@hotmail.com&gt;
 * @package 
 * =============================================================================
 */
namespace App\Handlers;
use Image;

class ImageUploadHandler
{
    // &#x53EA;&#x5141;&#x8BB8;&#x4EE5;&#x4E0B;&#x540E;&#x7F00;&#x540D;&#x7684;&#x56FE;&#x7247;&#x6587;&#x4EF6;&#x4E0A;&#x4F20;
    protected $allowed_ext = [&quot;png&quot;, &quot;jpg&quot;, &quot;gif&quot;, &apos;jpeg&apos;,&apos;gif&apos;];

    public function save($file, $folder, $file_prefix,$max_width=false)
    {
        // &#x6784;&#x5EFA;&#x5B58;&#x50A8;&#x7684;&#x6587;&#x4EF6;&#x5939;&#x89C4;&#x5219;&#xFF0C;&#x503C;&#x5982;&#xFF1A;uploads/images/avatars/201709/21/
        // &#x6587;&#x4EF6;&#x5939;&#x5207;&#x5272;&#x80FD;&#x8BA9;&#x67E5;&#x627E;&#x6548;&#x7387;&#x66F4;&#x9AD8;&#x3002;
        $folder_name = &quot;uploads/images/$folder/&quot; . date(&quot;Ym/d&quot;, time());

        // &#x6587;&#x4EF6;&#x5177;&#x4F53;&#x5B58;&#x50A8;&#x7684;&#x7269;&#x7406;&#x8DEF;&#x5F84;&#xFF0C;`public_path()` &#x83B7;&#x53D6;&#x7684;&#x662F; `public` &#x6587;&#x4EF6;&#x5939;&#x7684;&#x7269;&#x7406;&#x8DEF;&#x5F84;&#x3002;
        // &#x503C;&#x5982;&#xFF1A;/home/vagrant/Code/larabbs/public/uploads/images/avatars/201709/21/
        $upload_path = public_path() . &apos;/&apos; . $folder_name;

        // &#x83B7;&#x53D6;&#x6587;&#x4EF6;&#x7684;&#x540E;&#x7F00;&#x540D;&#xFF0C;&#x56E0;&#x56FE;&#x7247;&#x4ECE;&#x526A;&#x8D34;&#x677F;&#x91CC;&#x9ECF;&#x8D34;&#x65F6;&#x540E;&#x7F00;&#x540D;&#x4E3A;&#x7A7A;&#xFF0C;&#x6240;&#x4EE5;&#x6B64;&#x5904;&#x786E;&#x4FDD;&#x540E;&#x7F00;&#x4E00;&#x76F4;&#x5B58;&#x5728;
        $extension = strtolower($file-&gt;getClientOriginalExtension()) ?: &apos;png&apos;;

        // &#x62FC;&#x63A5;&#x6587;&#x4EF6;&#x540D;&#xFF0C;&#x52A0;&#x524D;&#x7F00;&#x662F;&#x4E3A;&#x4E86;&#x589E;&#x52A0;&#x8FA8;&#x6790;&#x5EA6;&#xFF0C;&#x524D;&#x7F00;&#x53EF;&#x4EE5;&#x662F;&#x76F8;&#x5173;&#x6570;&#x636E;&#x6A21;&#x578B;&#x7684; ID 
        // &#x503C;&#x5982;&#xFF1A;1_1493521050_7BVc9v9ujP.png
        $filename = $file_prefix . &apos;_&apos; . time() . &apos;_&apos; . str_random(10) . &apos;.&apos; . $extension;

        // &#x5982;&#x679C;&#x4E0A;&#x4F20;&#x7684;&#x4E0D;&#x662F;&#x56FE;&#x7247;&#x5C06;&#x7EC8;&#x6B62;&#x64CD;&#x4F5C;
        if ( ! in_array($extension, $this-&gt;allowed_ext)) {
            return false;
        }

        // &#x5C06;&#x56FE;&#x7247;&#x79FB;&#x52A8;&#x5230;&#x6211;&#x4EEC;&#x7684;&#x76EE;&#x6807;&#x5B58;&#x50A8;&#x8DEF;&#x5F84;&#x4E2D;
        $file-&gt;move($upload_path, $filename);
        //&#x5982;&#x679C;&#x9650;&#x5236;&#x4E86;&#x56FE;&#x7247;&#x7684;&#x5BBD;&#x5EA6;&#xFF0C;&#x5C31;&#x8FDB;&#x884C;&#x88C1;&#x526A;
        if($max_width &amp;&amp; $extension !=&apos;gif&apos;){
            //&#x6B64;&#x7C7B;&#x4E2D;&#x5C01;&#x88C5;&#x7684;&#x51FD;&#x6570;&#x7528;&#x4E8E;&#x88C1;&#x526A;&#x56FE;&#x7247;
            $this-&gt;reduceSize($upload_path . &apos;/&apos;.$filename,$max_width);
        }

        return [
            &apos;path&apos; =&gt; config(&apos;app.url&apos;) . &quot;/$folder_name/$filename&quot;
        ];
    }
    public function reduceSize($file_path,$max_width){
        //&#x5148;&#x5B9E;&#x4F8B;&#x5316;&#xFF0C;&#x4F20;&#x53C2;&#x662F;&#x6587;&#x4EF6;&#x7684;&#x78C1;&#x76D8;&#x7269;&#x7406;&#x8DEF;&#x5F84;
        $image=Image::make($file_path);
        //&#x8FDB;&#x884C;&#x5927;&#x5C0F;&#x8C03;&#x6574;&#x64CD;&#x4F5C;
        $image-&gt;resize($max_width,null,function($constraint){
            //&#x8BBE;&#x5B9A;&#x5BBD;&#x5EA6;&#x662F;$max_width,&#x9AD8;&#x5EA6;&#x7B49;&#x6BD4;&#x4F8B;&#x53CC;&#x65B9;&#x7F29;&#x653E;
            $constraint-&gt;aspectRatio();
            //&#x9632;&#x6B62;&#x622A;&#x56FE;&#x65F6;&#x56FE;&#x7247;&#x5C3A;&#x5BF8;&#x53D8;&#x5927;
            $constraint-&gt;upsize();
        });
        $image-&gt;save();
    }
}
</code></pre><p>&#x4FEE;&#x6539;controller&#x7684;&#x8C03;&#x7528;</p>
<pre><code>.
.
.
$result=$uploader-&gt;save($request-&gt;avatar,&apos;avatars&apos;,$user-&gt;id,416);
.
.
.
</code></pre><h2 id="&#x6D4B;&#x8BD5;"><a name="&#x6D4B;&#x8BD5;" class="anchor-navigation-ex-anchor" href="#&#x6D4B;&#x8BD5;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x6D4B;&#x8BD5;" class="plugin-anchor" href="#&#x6D4B;&#x8BD5;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6D4B;&#x8BD5;</h2>
<p><img src="http://images.kaleozhou.top/4.4-07.png" alt="4.4-07.png">
&#x7B2C;&#x4E00;&#x7AE0;&#x548C;&#x7B2C;&#x56DB;&#x7AE0;&#x662F;&#x4E00;&#x6837;&#x7684;&#x56FE;&#x7247;&#xFF0C;&#x5927;&#x5C0F;&#x7531;7.5M&#x7F29;&#x5C0F;&#x5230;47k&#x3002;&#x56FE;&#x7247;&#x5BBD;&#x5EA6;&#x53D8;&#x6210;&#x4E86;&#x6211;&#x4EEC;&#x8BBE;&#x7F6E;&#x7684;416</p>
<h2 id="&#x6388;&#x6743;&#x8BBF;&#x95EE;"><a name="&#x6388;&#x6743;&#x8BBF;&#x95EE;" class="anchor-navigation-ex-anchor" href="#&#x6388;&#x6743;&#x8BBF;&#x95EE;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x6388;&#x6743;&#x8BBF;&#x95EE;" class="plugin-anchor" href="#&#x6388;&#x6743;&#x8BBF;&#x95EE;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6388;&#x6743;&#x8BBF;&#x95EE;</h2>
<p>&#x7531;&#x4E8E;&#x73B0;&#x5728;&#x672A;&#x767B;&#x5F55;&#x7528;&#x6237;&#x4E5F;&#x53EF;&#x4EE5;&#x672A;&#x6388;&#x6743;&#x8BBF;&#x95EE;&#x7528;&#x6237;&#x7F16;&#x8F91;&#x9875;&#x9762;
<a href="http://kaleobbs.test/users/1/edit" target="_blank">http://kaleobbs.test/users/1/edit</a>
&#x5982;&#x4E0B;:
<img src="http://images.kaleozhou.top/4.4-08.png" alt="4.4-08.png">
&#x4EE5;&#x53CA;&#x767B;&#x5F55;&#x7684;&#x7528;&#x6237;&#x53EF;&#x4EE5;&#x8BBF;&#x95EE;&#x5176;&#x4ED6;&#x4EBA;&#x7684;&#x8D44;&#x6599;&#xFF0C;&#x751A;&#x81F3;&#x4FEE;&#x6539;&#x5185;&#x5BB9;&#xFF0C;&#x8FD9;&#x660E;&#x663E;&#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;</p>
<h2 id="&#x9650;&#x5236;&#x6E38;&#x5BA2;&#x8BBF;&#x95EE;"><a name="&#x9650;&#x5236;&#x6E38;&#x5BA2;&#x8BBF;&#x95EE;" class="anchor-navigation-ex-anchor" href="#&#x9650;&#x5236;&#x6E38;&#x5BA2;&#x8BBF;&#x95EE;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x9650;&#x5236;&#x6E38;&#x5BA2;&#x8BBF;&#x95EE;" class="plugin-anchor" href="#&#x9650;&#x5236;&#x6E38;&#x5BA2;&#x8BBF;&#x95EE;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9650;&#x5236;&#x6E38;&#x5BA2;&#x8BBF;&#x95EE;</h2>
<p>Laravel&#x4E2D;&#x95F4;&#x4EF6;(MIddleware)&#x4E3A;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x79CD;&#x975E;&#x5E38;&#x68D2;&#x7684;&#x8FC7;&#x6EE4;&#x673A;&#x5236;&#x6765;&#x8FDB;&#x5165;&#x5E94;&#x7528;&#x7684;HTTP&#x8BF7;&#x6C42;&#xFF0C;&#x4F8B;&#x5982;&#xFF0C;&#x5F53;&#x6211;&#x4EEC;&#x4F7F;&#x7528;Auth&#x4E2D;&#x95F4;&#x4EF6;&#x6765;&#x9A8C;&#x8BC1;
&#x7528;&#x6237;&#x8EAB;&#x4EFD;&#x65F6;&#xFF0C;&#x5982;&#x679C;&#x7528;&#x6237;&#x672A;&#x901A;&#x8FC7;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#xFF0C;&#x5219;Auth&#x4E2D;&#x95F4;&#x4EF6;&#x4F1A;&#x628A;&#x7528;&#x6237;&#x91CD;&#x65B0;&#x5B9A;&#x5411;&#x5230;&#x767B;&#x5F55;&#x9875;&#x9762;&#x3002;&#x5982;&#x679C;&#x7528;&#x6237;&#x901A;&#x8FC7;&#x4E86;&#x9A8C;&#x8BC1;&#xFF0C;&#x5219;Auth&#x4E2D;&#x95F4;&#x4EF6;&#x4F1A;&#x901A;&#x8FC7;
&#x6B64;&#x8BF7;&#x6C42;&#x5E76;&#x7EE7;&#x7EED;&#x6267;&#x884C;&#x3002;Laravel&#x6846;&#x67B6;&#x9ED8;&#x8BA4;&#x4E3A;&#x6211;&#x4EEC;&#x5185;&#x7F6E;&#x4E86;&#x4E00;&#x4E9B;&#x4E2D;&#x95F4;&#x4EF6;&#xFF0C;&#x4F8B;&#x5982;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;&#x3001;csrf&#x4FDD;&#x62A4;&#x7B49;&#x3002;&#x6240;&#x6709;&#x4E2D;&#x95F4;&#x4EF6;&#x6587;&#x4EF6;&#x90FD;&#x88AB;&#x653E;&#x5728;&#x9879;&#x76EE;&#x7684;app/Http/Middleware&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#x3002;
&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x4F7F;&#x7528;Laravel&#x63D0;&#x4F9B;&#x7684;&#x8EAB;&#x4EFD;&#x9A8C;&#x8BC1;Auth&#x4E2D;&#x95F4;&#x4EF6;&#x6765;&#x8FC7;&#x6EE4;&#x672A;&#x767B;&#x5F55;&#x7528;&#x6237;&#x7684;edit&#x3001;update&#x52A8;&#x4F5C;:</p>
<pre><code>.
.
.
    public function __construct(){
        $this-&gt;middleware(&apos;auth&apos;,[&apos;except&apos;=&gt;[&apos;show&apos;]]);
    }
.
.
.
</code></pre><h2 id="&#x767B;&#x5F55;&#x7528;&#x6237;&#x53EA;&#x80FD;&#x53C8;&#x8BE5;&#x81EA;&#x5DF1;&#x7684;&#x8D44;&#x6599;"><a name="&#x767B;&#x5F55;&#x7528;&#x6237;&#x53EA;&#x80FD;&#x53C8;&#x8BE5;&#x81EA;&#x5DF1;&#x7684;&#x8D44;&#x6599;" class="anchor-navigation-ex-anchor" href="#&#x767B;&#x5F55;&#x7528;&#x6237;&#x53EA;&#x80FD;&#x53C8;&#x8BE5;&#x81EA;&#x5DF1;&#x7684;&#x8D44;&#x6599;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x767B;&#x5F55;&#x7528;&#x6237;&#x53EA;&#x80FD;&#x53C8;&#x8BE5;&#x81EA;&#x5DF1;&#x7684;&#x8D44;&#x6599;" class="plugin-anchor" href="#&#x767B;&#x5F55;&#x7528;&#x6237;&#x53EA;&#x80FD;&#x53C8;&#x8BE5;&#x81EA;&#x5DF1;&#x7684;&#x8D44;&#x6599;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x767B;&#x5F55;&#x7528;&#x6237;&#x53EA;&#x80FD;&#x53C8;&#x8BE5;&#x81EA;&#x5DF1;&#x7684;&#x8D44;&#x6599;</h2>
<p>&#x5728;Laravel&#x4E2D;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x6388;&#x6743;&#x7B56;&#x7565;(Policy)&#x6765;&#x5BF9;&#x7528;&#x6237;&#x7684;&#x6388;&#x6743;&#x8FDB;&#x884C;&#x9A8C;&#x8BC1;&#xFF0C;&#x5728;&#x7528;&#x6237;&#x672A;&#x7ECF;&#x6388;&#x6743;&#x8FDB;&#x884C;&#x64CD;&#x4F5C;&#x5C06;&#x8FD4;&#x56DE;403&#x7981;&#x6B62;&#x8BBF;&#x95EE;&#x5F02;&#x5E38;&#x3002;
&#x6211;&#x7528;&#x5982;&#x4E0B;&#x547D;&#x4EE4;&#x751F;&#x6210;&#x4E00;&#x4E2A;UserPolicy&#x7684;&#x6388;&#x6743;&#x7B56;&#x7565;&#x7C7B;&#x6587;&#x4EF6;&#xFF0C;&#x7528;&#x4E8E;&#x7BA1;&#x7406;&#x7528;&#x6237;&#x6A21;&#x578B;&#x7684;&#x6388;&#x6743;&#x3002;</p>
<pre><code>vagrant@homestead:~/Code/kaleobbs$ php artisan make:policy UserPolicy
Policy created successfully.
</code></pre><p>&#x4E3A;&#x7528;&#x6237;&#x7B56;&#x7565;&#x6587;&#x4EF6;&#x6DFB;&#x52A0;update&#x65B9;&#x6CD5;&#xFF0C;&#x7528;&#x4E8E;&#x7528;&#x6237;&#x66F4;&#x65B0;&#x662F;&#x7684;&#x6743;&#x9650;&#x9A8C;&#x8BC1;&#x3002;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim app/Policies/UserPolicy.php
</code></pre><p>&#x5982;&#x4E0B;</p>
<pre><code>&lt;?php

namespace App\Policies;

use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class UserPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }
    public function update(User $currentUser,User $user){
        return $currentUser-&gt;id === $user-&gt;id;
    }
}
</code></pre><p>&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728;AuthServiceProvider&#x7C7B;&#x4E2D;&#x5BF9;&#x6388;&#x6743;&#x7B56;&#x7565;&#x8FDB;&#x884C;&#x6CE8;&#x518C;&#x3002;</p>
<pre><code>&#x279C; kaleo@zhou  ~/Code/kaleobbs git:(master) &#x2717; vim app/Providers/AuthServiceProvider.php
</code></pre><p>&#x5982;&#x4E0B;</p>
<pre><code>&lt;?php

namespace App\Providers;

use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        &apos;App\Model&apos; =&gt; &apos;App\Policies\ModelPolicy&apos;,
        \App\Models\User::class=&gt;\App\Policies\UserPolicy::class,
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this-&gt;registerPolicies();

        //
    }
}
</code></pre><p>&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728;&#x63A7;&#x5236;&#x5668;&#x4E2D;&#x6DFB;&#x52A0;anthorize&#x65B9;&#x6CD5;&#x6765;&#x68C0;&#x9A8C;&#x7528;&#x6237;&#x662F;&#x5426;&#x6388;&#x6743;&#x3002;</p>
<pre><code>&lt;?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\User;
use App\Http\Requests\UserRequest;
use App\Handlers\ImageUploadHandler;

class UsersController extends Controller
{
    public function __construct(){
        $this-&gt;middleware(&apos;auth&apos;,[&apos;except&apos;=&gt;[&apos;show&apos;]]);
    }
    //&#x4E2A;&#x4EBA;&#x9875;&#x9762;&#x5C55;&#x793A;
    public function show(User $user)
    {
        return view(&apos;users.show&apos;,compact(&apos;user&apos;));
    }
    //&#x8D44;&#x6599;&#x7F16;&#x8F91;
    public function edit(User $user)
    {
        $this-&gt;authorize(&apos;update&apos;,$user);
        return view(&apos;users.edit&apos;,compact(&apos;user&apos;));
    }
    //&#x66F4;&#x65B0;&#x7528;&#x6237;&#x4FE1;&#x606F;
    public function update(UserRequest $request,ImageUploadHandler $uploader,User $user)
    {
        $this-&gt;authorize(&apos;update&apos;,$user);
        $data=$request-&gt;all();
        if($request-&gt;avatar){
            $result=$uploader-&gt;save($request-&gt;avatar,&apos;avatars&apos;,$user-&gt;id,416);
            if($result)
            {
                $data[&apos;avatar&apos;]=$result[&apos;path&apos;];
            }
        }

        $user-&gt;update($data);
        return redirect()-&gt;route(&apos;users.show&apos;,$user-&gt;id)-&gt;with(&apos;success&apos;,&apos;&#x4E2A;&#x4EBA;&#x8D44;&#x6599;&#x66F4;&#x65B0;&#x6210;&#x529F;!&apos;);
    }
}
</code></pre><h2 id="&#x6388;&#x6743;&#x6D4B;&#x8BD5;"><a name="&#x6388;&#x6743;&#x6D4B;&#x8BD5;" class="anchor-navigation-ex-anchor" href="#&#x6388;&#x6743;&#x6D4B;&#x8BD5;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x6388;&#x6743;&#x6D4B;&#x8BD5;" class="plugin-anchor" href="#&#x6388;&#x6743;&#x6D4B;&#x8BD5;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6388;&#x6743;&#x6D4B;&#x8BD5;</h2>
<p>&#x7528;&#x6237;2&#x767B;&#x5F55;&#x8BBF;&#x95EE;&#x7528;&#x6237;1&#x7684;&#x7F16;&#x8F91;&#x9875;&#x9762;
<img src="http://images.kaleozhou.top/4.4-09.png" alt="4.4-09.png"></p>
<p>&#x5B8C;&#x6210;</p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; kaleozhou 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2019-05-20 16:19:42
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="3.html" class="navigation navigation-prev " aria-label="Previous page: 4.3 显示个人资料">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../chapter5/readme.html" class="navigation navigation-next " aria-label="Next page: 第五章 帖子功能开发">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"4.4 上传头像","level":"1.5.4","depth":2,"next":{"title":"第五章 帖子功能开发","level":"1.6","depth":1,"path":"chapter5/readme.md","ref":"chapter5/readme.md","articles":[{"title":"5.1 帖子分类","level":"1.6.1","depth":2,"path":"chapter5/1.md","ref":"chapter5/1.md","articles":[]},{"title":"5.2 代码生成器","level":"1.6.2","depth":2,"path":"chapter5/2.md","ref":"chapter5/2.md","articles":[]},{"title":"5.3 生成话题骨架","level":"1.6.3","depth":2,"path":"chapter5/3.md","ref":"chapter5/3.md","articles":[]},{"title":"5.4 假数据填充","level":"1.6.4","depth":2,"path":"chapter5/4.md","ref":"chapter5/4.md","articles":[]},{"title":"5.5 话题列表页面","level":"1.6.5","depth":2,"path":"chapter5/5.md","ref":"chapter5/5.md","articles":[]},{"title":"5.6 性能优化","level":"1.6.6","depth":2,"path":"chapter5/6.md","ref":"chapter5/6.md","articles":[]},{"title":"5.7 分类下的话题列表","level":"1.6.7","depth":2,"path":"chapter5/7.md","ref":"chapter5/7.md","articles":[]},{"title":"5.8 话题排序","level":"1.6.8","depth":2,"path":"chapter5/8.md","ref":"chapter5/8.md","articles":[]},{"title":"5.9 用户发布的话题","level":"1.6.9","depth":2,"path":"chapter5/9.md","ref":"chapter5/9.md","articles":[]}]},"previous":{"title":"4.3 显示个人资料","level":"1.5.3","depth":2,"path":"chapter4/3.md","ref":"chapter4/3.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","splitter","expandable-chapters-small","anchors","donate","sharing-plus","anchor-navigation-ex","tbfed-pagefooter","favicon"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy kaleozhou 2019","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"github":{"url":"https://gitee.com/kaleozhou"},"splitter":{},"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"donate":{"alipay":"http://images.kaleozhou.top/zanshang.png","alipayText":" ","button":"赞赏","title":"","wechat":"","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"favicon":{"shortcut":"./book.ico","bookmark":"./book.ico","appleTouch":"./book.ico","appleTouchMore":{"120x120":"./book.ico","180x180":"./book.ico"}},"github-buttons":{"buttons":[{"user":"kaleozhou","repo":"guanwang","type":"star","size":"small","count":true}]},"expandable-chapters-small":{},"sharing":{"qq":true,"all":["weibo","qq","qzone"],"douban":true,"facebook":false,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{}},"theme":"default","author":"kaleozhou","pdf":{"pageBreaksBefore":"/","paperSize":"a4","margin":{"right":30,"left":30,"top":30,"bottom":50},"fontSize":18,"pageSize":"a4","fontFamily":"Arial","doc":true,"chapterMark":"pagebreak","pageNumbers":true},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Laravel学习-从零开发论坛系统","language":"zh-hans","links":{"sidebar":{"我的博客":"http://www.kaleozhou.top"}},"gitbook":"3.2.3","description":"laravel框架开发论坛系统"},"file":{"path":"chapter4/4.md","mtime":"2019-05-20T08:19:42.704Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-25T02:56:39.861Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

